home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************/
- /* FLOW exec */
- /* */
- /* JJB July 1989 */
- /***********************************************************************/
- address 'COMMAND'
- signal on novalue
- parse source . . execname .
-
- optset = "COMMON_TABLE STRUCTURE_CHART GRAPHICS NODE"
- sngset = "QUERY EXTERNALS"
- LOG = 'Y'
- err = ' '
- do i = 1 to words(optset)
- interpret word(optset,i) " = ' '"
- end
- do i = 1 to words(sngset)
- interpret word(sngset,i) " = 'NO'"
- end
-
- interactive = "YES"
- parse upper arg input
- parse value input with filename '(' options
- if filename = "?" then do; ADDRESS CMS 'HELP 'execname; signal EXIT; end
- err = "Fill in the blank field(s) as required."
- cursor = "0001"
-
- if options ^= ' ' then do
- interactive = "NO"
- nopts = words(options)
- iopt = 0 ; err = " "
- do forever
- iopt = iopt + 1 ; if iopt > nopts then leave
- if find(sngset,word(options,iopt)) ^= 0 then do
- interpret word(options,iopt)||'="YES"'
- iterate
- end
- if iopt < nopts then do
- val2 = ' ' ; val3 = ' '
- key = word(options,iopt) ; val1 = word(options,iopt+1)
- if find(optset,key) = 0 then do
- err = "Unidentified option on command line: "key
- signal EXIT
- end
- if iopt + 1 < nopts then val2 = word(options,iopt+2)
- if iopt + 2 < nopts then val3 = word(options,iopt+3)
- if find(optset,val2) ^= 0 | find(sngset,val2) ^= 0 then do
- val2 = ' ' ; val3 = ' '
- end
- if find(optset,val3) ^= 0 | find(sngset,val3)^=0 then val3 = ' '
- interpret key "= '"val1 val2 val3"'"
- iopt = iopt + words(val1 val2 val3)
- iterate
- end
- if iopt = nopts then do
- err = 'Missing value for option 'word(options,iopt)
- signal EXIT
- end
- end
- end
-
- /****************/
- /* GENERAL MODE */
- /****************/
-
- if interactive = "NO" then signal CHECK
- if ^'QCONSOLE'('GRAPHIC') then do
- err = 'Not a full screen device'
- signal EXIT
- end
- START:
- do forever
- signal off error
- 'IOS3270' execname 'PANEL ;PANEL1 (CLEAR 'cursor
- /* signal on error ios3270 gives codes that aren't errors...*/
- if IOSK = 'PF03' then do; err = ' '; signal EXIT; end
- if IOSK = 'PF02' then do
- say "Enter the CMS command :"
- parse pull command
- signal off error; ADDRESS CMS command; signal on error
- say "Continue with "execname" ? [CR=YES]"
- parse upper pull answer
- if abbrev(answer,"N",1) then signal EXIT
- iterate
- end
- if IOSK = 'PF01' then do
- ADDRESS CMS 'HELP 'execname
- end
- leave
- end
-
- CHECK:
- err = ' '
- do i = 1 to words(optset)
- interpret "upper "word(optset,i)
- end
- do i = 1 to words(sngset)
- interpret "upper "word(sngset,i)
- end
-
- intree = filename
- if words(intree) = 2 then intree = intree "*"
- if words(intree) = 1 then intree = intree "FLOPTRE *"
-
- if intree ^= " " then do
- if ^'FEXIST'(intree) then do
- err = "Binary file "intree" does not exist."
- cursor = "0001"
- if interactive = "YES" then signal START
- signal EXIT
- end
- end
-
- if words(common_table) = 2 then common_table = common_table "A"
- if words(common_table) = 1 then common_table = common_table "COMMONS A"
-
- if words(structure_chart) = 2 then structure_chart = structure_chart "A"
- if words(structure_chart) = 1 then structure_chart = structure_chart "CHART A"
-
- if words(graphics) = 2 then graphics = graphics "A"
- if words(graphics) = 1 then do
- graphics = graphics "LISTPS A"
- end
-
- if node ^= ' ' & graphics = ' ' & structure_chart = ' ' then do
- err = "You must specify a file name for either graphics or text."
- cursor = "0004"
- if interactive = "YES" then signal START
- signal EXIT
- end
-
-
- if graphics = ' ' & query = 'NO' & structure_chart = ' ',
- & common_table = ' ' then do
- err = "There is nothing for FLOW to do !"
- cursor = "0001"
- if interactive = "YES" then signal START
- signal EXIT
- end
-
- 'CLRSCRN'
-
- /* Now assign the FILEDEFs */
- 'MAKEBUF'
- bufno = rc
- 'SENTRIES'
- entries = rc
- 'QFILEDEF ( STACK'
- pull dummy
- num_fdefs = 0
- do queued()-entries
- num_fdefs = num_fdefs + 1
- pull fdef.num_fdefs
- end
- 'DROPBUF 'bufno
-
- control = ' '
- say "FLOW: Input binary file "intree
- 'FILEDEF 50 DISK 'intree' (LRECL 8000 RECFM VS'
- if common_table ^= " " then do
- say " COMMON block usage table "common_table
- 'FILEDEF 60 DISK 'common_table' (LRECL 132 RECFM F'
- control = control||' common'
- end
- if structure_chart ^= " " then do
- say " Text version of chart will be "structure_chart
- 'FILEDEF 61 DISK 'structure_chart' (LRECL 132 RECFM F'
- control = control||' chart'
- end
- if graphics ^= ' ' then do
- say " Graphics version of chart will be "graphics
- 'FILEDEF 96 DISK 'graphics' (LRECL 80 RECFM F'
- control = control||' graphics'
- end
- if externals ^= 'NO' then do
- say " External routine names will be displayed"
- control = control||' externals'
- end
- if query ^= 'NO' then do
- say " You will explore the tree interactively"
- control = control||' query'
- end
- if node ^= ' ' then,
- say " The tree will start at node "node
- else node = '$$$$'
- control = control||' node '||node
- if 'FEXIST'('FLOW$TMP CONTROL A') then 'ERASE FLOW$TMP CONTROL A'
- 'EXECIO 1 DISKW FLOW$TMP CONTROL A 1 F (FINIS STRING 'control
- 'FILEDEF 1 DISK FLOW$TMP CONTROL A '
-
- say 'FLOW begins .... '
- 'LOAD CMSFLOW (CLEAR START'
- 'ERASE FLOW$TMP CONTROL A'
- 'FILEDEF 1 CLEAR'
- 'FILEDEF 50 CLEAR'
- if graphics ^= ' ' then 'FILEDEF 96 CLEAR'
- if common_table ^= ' ' then 'FILEDEF 60 CLEAR'
- if structure_chart ^= ' ' then 'FILEDEF 61 CLEAR'
-
- /* Reinstate original FILEDEFs */
- do i = 1 to num_fdefs
- fdef.i
- end
- say 'FLOW has finished'
-
- call EXIT
-
-
- NOVALUE:
- say 'Uninitialised variable encountered on line' sigl
- call EXIT
-
- ERROR:
- say 'Error on line' sigl
- call EXIT
-
- EXIT:
- if err ^= " " then say execname ": " err
- exit
-